﻿@{
    ViewBag.Title = "Custome";
}

@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <link href="@Url.Content("~/content/css/kingprt.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/content/css/bootstrap.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/content/css/KingcensSet.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/content/css/font-awesome.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.PrintArea.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/Base/print.js")" type="text/javascript"></script> 
}
<form id="form1" runat="server" method="post" style = "width:100%;height:90%">
        <table width = "400px" style="margin-left:50px;margin-top:30px">
            <tr>
                <td width="100px" height ="50px" align="right" class="fonthsx"><font color="#FF0000" size ="5" >提示：</td>
                <td width="200px" >
                    <font color="#FF0000" size ="5" ><span id="FActionMsg">输入激活码进行系统激活，要激活吗？</span></font>
                </td>
            </tr>
            <tr>
                <td width="100px" height ="50px" align="right" class="fonthsx">有效期至：</td>
                <td>
                    <div id="EndTimes" name="EndTimes" class="fonthsx"></div>
                </td>
            </tr>
            <tr>
                <td height="50px" align="right" class="fonthsx">激活码：</td>
                <td>
                    <input id="ActionCode"  type="text" class="form-control" placeholder="请输入激活码">
                </td>
                <td style="padding-left:5px;">
                    
                </td>
            </tr>
        </table>
        <table style="margin-left:20px;margin-top:30px">
            <tr>
                <td width="30px" height="50px" class="fonthsx"></td>
                <td width="280px" height="50px" class="fonthsx">
                    <div class="user-register" style="float:left;">没有激活码？ <a href="javascript:gotoTerminal()" class="register">充值续费</a></div>                    
                </td>
                <td width="100px" height="50px" align="right">
                    <input type="button" id="ActionBtn" value="开始激活"  class="btn btn-default" style="width:90px;"/>
                </td>
                <td width="150px" height="50px" align="center" style="padding-left:5px;">
                    <input type="button" id="CancelBtn" value="关闭"  class="btn btn-default" style="width:90px;"/>
                </td>
            </tr>
        </table>
    
<script>
    function FormShown() {
        load();
    }

    $(function () {
        $("#ActionBtn").bind("click", Action);
        $("#CancelBtn").bind("click", CloseWindow);
    });

    function load() {
        $.post("GetCorpDefault", { mSystemAppID: parent.window.getSystemAppID() }, function (data) {
            var form = new mini.Form("form1");
            var mdata = mini.decode(data);
            $("#EndTimes").html(mdata.data[0].FEndTime.format("yyyy-MM-dd"));
            //$("#FActionMsg").html("系统已激活，确定继续激活吗？");
        });
    }

    var Action = function () {
        if ($("#ActionCode").val().length == "") {
            mini.alert("激活码未输入");
            return;
        }
        mini.confirm("确定要使用此激活码？", "提示",
        function (action) {
            if (action == "ok") {
                $("#ActionBtn").addClass("disabled");
                var jsonstr = '[{"AcCode":"' + $("#ActionCode").val() + '","mSystemAppID":"' + parent.window.getSystemAppID() + '"}]';
                $.post("ActionCode", { mjson: jsonstr }, function (data) {
                    var ret = mini.decode(data);
                    if (ret.status == 1) {
                        mini.alert("激活成功,请重新登录.");
                        $("#ActionCode").val('');
                        CloseWindow('Activated');
                        //load();
                    }
                    else {
                        mini.alert("激活失败," + ret.error);
                    }
                })
                .success(function () { })
                .error(function () { })
                .complete(function () { $("#ActionBtn").removeClass("disabled"); });
            }
        });
    }

    function gotoTerminal() {
        parent.window.showTabById("134_Terminal", "充值续费", "../AppCenter/Terminal");
        CloseWindow('recharge');
    }

</script>
</form>